// @author: caoshi
// @date: 2021-05-04 17:47
// 客户端
package main

import (
	"fmt"
	"net"
	"strconv"
)

func main() {
	addr, _ := net.ResolveTCPAddr("tcp4", "localhost:8899")

	for i := 0; i < 5; i++ {
		conn, _ := net.DialTCP("tcp4", nil, addr)
		conn.Write([]byte("客户端发送的信息" + strconv.Itoa(i)))
		// 准备接收服务端的反馈信息
		data := make([]byte, 1024)
		count, _ := conn.Read(data)

		fmt.Println("服务端的响应信息: ", string(data[:count]))
		conn.Close()
	}

}
